from langchain_openai import ChatOpenAI
import os
from langchain_core.output_parsers import StrOutputParser
base_url = os.environ.get("BAOCLOUD_DS_BASE_URL")
model_name = os.environ.get("BAOCLOUD_DS_MODEL_NAME")
os.environ["OPENAI_API_KEY"] = os.getenv("BAOCLOUD_DS_API_KEY")

parser = StrOutputParser()

model = ChatOpenAI(base_url=base_url, model_name=model_name)
result = model.invoke("你是谁？")
res_content = parser.invoke(result)
print(res_content)
